<!--
 * @Description: 拒绝审核模态框
 * @version: 电子名片2.0
 * @Author: 尹鑫
 * @Date: 2020-12-02 09:31:17
 * @LastEditors: 尹鑫
 * @LastEditTime: 2020-12-16 10:25:03
-->
<template>
  <el-dialog
    :title="title"
    :visible.sync="_showRejectModal"
    :custom-class="'rejectModal'"
    :close-on-click-modal="false"
    :top="'0'"
  >
    <el-form ref="form" :model="form" label-width="90px" :validate-on-rule-change="false">
      <el-form-item label="拒绝原因：">
        <el-input v-model="_rejectReason" type="textarea" :rows="8" :resize="'none'" :placeholder="'请输入拒绝原因'" :maxlength="120" :show-word-limit="true" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" type="primary" @click="confireModal">确认</el-button>
      <el-button size="small" @click="cancelModal">取消</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: '请传入模态框标题'
    },
    showRejectModal: {
      type: Boolean,
      default: false
    },
    reason: {
      type: String,
      default: ''
    }
  },
  data: () => {
    return {
      form: {}
    }
  },
  computed: {
    _showRejectModal: {
      get() {
        return this.showRejectModal
      },
      set(value) {
        this.$emit('update:showRejectModal', value)
      }
    },
    _rejectReason: {
      get() {
        return this.reason
      },
      set(value) {
        this.$emit('update:reason', value)
      }
    }
  },
  methods: {
    // 确认操作
    confireModal() {
      if (!this._rejectReason) {
        this.$message({
          message: '拒绝原因不能为空',
          type: 'warning'
        })
        return
      }
      this._showRejectModal = false
      this.$emit('confire', this._rejectReason)
      this._rejectReason = ''
    },
    // 取消操作
    cancelModal() {
      this._showRejectModal = false
      this._rejectReason = ''
    }
  }
}
</script>
<style>
  .rejectModal {
    top: 50%;
    transform: translateY(-50%);
    width: 420px;
    vertical-align: middle;
    background-color: #FFFFFF;
    border-radius: 4px;
    border: 1px solid #e6ebf5;
    font-size: 18px;
    -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    text-align: left;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    padding-bottom: 10px;
  }
  .rejectModal .el-dialog__header{
    background-color: rgba(240, 242, 245, 1);
    padding: 15px;
    padding-bottom: 14px;
    height: 43px;
  }
  .rejectModal .el-dialog__header .el-dialog__title{
    padding-left: 0;
    margin-bottom: 0;
    font-size: 18px;
    line-height: 1;
    color: #303133;
  }
  .rejectModal .el-dialog__header .el-dialog__headerbtn{
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
  }
  .rejectModal .el-dialog__footer{
    padding:5px 15px 0;
  }
</style>
